<!--
 * @Author: your name
 * @Date: 2020-10-09 17:57:52
 * @LastEditTime: 2020-12-23 09:25:18
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \solaxcloud\src\components\Sidebar.vue
-->
<template>
    <div class="navMenu">
        <template v-for="navMenu in navMenus">
            <!-- 顶级无子集菜单 -->
            <el-menu-item v-if="!navMenu.childs && navMenu.spid == '0'" :key="navMenu.sid" :data="navMenu" :index="navMenu.menuURL"  style="height: 80px;line-height: 80px;">
                <!-- <span slot="title">{{navMenu.menuName}}</span> -->
                <span class="mneus-text" v-if="navMenu.sid == '2'||navMenu.sid == '1'">
                        <i class="el-icon-tickets" style="margin-bottom:10px;font-size:25px;"></i>
                        <br>
                    {{navMenu.menuName}}
                </span>
                <span class="mneus-text" v-else>
                        <i :class="navMenu.menuImage || 'el-icon-edit'" style="margin-bottom:10px;font-size:25px;"></i>
                        <br>
                    {{$t('m_'+navMenu.sid)}}
                </span>
            </el-menu-item>
            
            <!-- 子集菜单 -->
            <el-menu-item v-else-if="!navMenu.childs" :key="navMenu.sid" :data="navMenu" :index="navMenu.menuURL" >
                <!-- <span slot="title">{{navMenu.menuName}}</span> -->
                <span slot="title" :title="$t('m_'+navMenu.sid)">{{$t('m_'+navMenu.sid)}}</span>
            </el-menu-item>

            <!-- 顶级有子集菜单 -->
            <el-submenu v-else-if="navMenu.childs" :key="navMenu.sid" :data="navMenu" :index="navMenu.sid">
                <template slot="title">
                    <!-- <i class="el-icon-edit"></i>
                    <br> -->
                    <span class="mneus-text">
                        <i :class="navMenu.menuImage || 'el-icon-edit'" style="margin-bottom:10px;font-size:25px;"></i>
                        <br>
                    {{$t('m_'+navMenu.sid)}}</span>
                </template>
                <NavMenu :navMenus="navMenu.childs"></NavMenu>
            </el-submenu>

        </template>
    </div>
</template>

<script>
export default {
    name:'NavMenu',
    // props:['navMenus'],
    props:{
        navMenus:{
            type:Array,
            default:()=>{return []}
        },
        collapse:{
            type:Boolean,
            default:false
        }
    },
    data(){
        return{}
    },
    methods:{
        cs(){
            console.log('cessdadasdas');
        }
    }
}
</script>

<style lang="less">
.sidebar{
    float: left;
    width: 230px;
    height: 100%;
    overflow: auto;
    background-color:#394456;
    .mneus-text{
        display:block;
        white-space:pre-wrap;
        word-break:keep-all;
        max-width:250px;
        overflow:visible;
        height:auto;
        line-height:normal;
        padding:10px 10px;
        text-align: center;
        transform: translate(-11px,5px);
        color:#fff;
        i{
            color:#fff;
        }
    }
   .el-submenu .el-menu-item {
        background: #30343F !important;
    }
    .el-submenu .el-menu-item:hover{
         background: #696d77 !important;
    }
    .el-menu{
        background: #394456;
    }
    .el-menu-item, .el-submenu__title  {
        height: 42px ;
        line-height: 42px;
        // border-bottom: 2px solid #FFFFFF;
    }
    .is-opened{
        background-color: #30343F;
        border-bottom-color: #ffb400;
        border-bottom: 1px;
        color: #fff;
        .el-submenu__title{
            border-bottom: 1px solid #ffb400;
        }
        .el-submenu__title:hover{
            border-bottom: 1px solid #ffb400;
        }
    }
    .el-menu-item:focus, .el-menu-item:hover ,.el-submenu__title:hover,.el-menu-item.is-active {
        background: #696d77 !important;
        // background-color: #30343F;
        border-bottom-color: #ffb400;
        border-bottom: none;
        color: #fff;
    }
    
    .el-menu-item{
        color:#fff;
        // background-color: rgb(43, 41, 41);
        i{
            color: #fff;
        }
    }
    .el-submenu{
        .el-menu-item {
            height: 38px;
            line-height: 38px;
            // border-bottom: 1px solid #fff;
            background: #ddd;
            color:#fff;
            min-width: 200px;
            overflow: hidden;
            text-overflow: ellipsis;
            padding-right: 10px;
            padding-left: 20px;
            i{
                color: #fff;
            }
            &:hover,&.is-active{
                background: #b3b3b3;
                color: #fff;
            }
        }

    } 
    .el-submenu.is-active .el-submenu__title{
        // background-color: rgba(253, 184, 19, 0.5);
        border-bottom-color: #ffb400;
    }
    .el-submenu__title  {
        height: 80px ;
        line-height: 80px;
        // border-bottom: 2px solid #FFFFFF; 
    }

}
</style>